home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-02-17 | 5.9 KB | 137 lines | [TEXT/ToyS] |
- (*
-
- Sample script to show the DocBreaker-DocAssembler team scripting features
- Before using this sample script, you need:
-
- - AppleScript software installed
- - XTND software installed
- - the DocBreaker application installed
- - the DocAssembler application installed in the same folder as DocBreaker
- - the "Examples" folder from the DocBreaker package in the same folder as DocBreaker
-
- This example shows a RTF -> MacWrite Pro -> RTF translation.
- If the required translators are not available, you will have to change the script.
-
- *)
-
- with timeout of 600 seconds
- try
- tell application "DocBreaker 1.0"
- activate
-
- -- assign the preferences
-
- set preference max files to 5
-
- set preference font rule to is_equal_to
- set preference font to "Courier"
-
- set preference size rule to is_greater_than
- set preference size to 14
-
- set preference style rule to is_equal_to
- set preference style to plain -- this is needed to override existing preferences
- set preference style to underline
- set preference style to bold
-
- set preference justification rule to differs_from
- set preference justification to right
-
- set preference color rule to is_equal_to
- set preference color to red
-
- -- breaks the file "FileToBreak.rtf" and produces a file series called "Part.xxx"
- -- asking to the MacWrite Pro 1.x translator to build MacWrite Pro files
-
- break the file ":Examples:FileToBreak.rtf" into file ":Examples:Part" using translator "MacWrite Pro 1.x" with format "MWPd"
- quit
- end tell
-
- tell application "DocAssembler 1.0"
- activate
- set theDoc to (make new document)
-
- -- append some files along with their hierarchical level
- -- Level 0 is the top (section) level
- -- Level -1 is the second (sub-section) level
- -- Level -2 is the third (chapter) level
- -- Level -3 is the bottom (paragraph) level
-
- tell theDoc to add the file ":Examples:part.001" with level 0
- tell theDoc to add the file ":Examples:part.002" with level -1
- tell theDoc to add the file ":Examples:part.003" with level -1
- tell theDoc to add the file ":Examples:part.004" with level -2
- tell theDoc to add the file ":Examples:part.005" with level -3
-
- -- assign the general preferences
-
- tell theDoc to set preference units to inches
- tell theDoc to set preference left margin to 1.5
- tell theDoc to set preference right margin to 1.5
- tell theDoc to set preference top margin to 2.0
- tell theDoc to set preference bottom margin to 2.0
- tell theDoc to set preference with double sided
- tell theDoc to set preference with include indexes
- tell theDoc to set preference starting page to 3
-
- -- assign the left header preferences
-
- tell theDoc to set output option left header with include
- tell theDoc to set output option left header font to "Courier"
- tell theDoc to set output option left header size to 14
- tell theDoc to set output option left header style to plain -- this is needed to override preferences file
- tell theDoc to set output option left header style to underline
- tell theDoc to set output option left header justification to center
- tell theDoc to set output option left header color to blue
- tell theDoc to set output option left header text to "This is a Courier 14, underlined, centered, blue left header"
-
- -- assign the right header preferences
-
- tell theDoc to set output option right header with include
- tell theDoc to set output option right header font to "Geneva"
- tell theDoc to set output option right header size to 12
- tell theDoc to set output option right header style to plain -- this is needed to override preferences file
- tell theDoc to set output option right header style to bold
- tell theDoc to set output option right header justification to right
- tell theDoc to set output option right header color to red
- tell theDoc to set output option right header text to "This is a Geneva 12, bolded, right justified, red right header"
-
- -- assign the left footer preferences
-
- tell theDoc to set output option left footer with include
- tell theDoc to set output option left footer font to "Helvetica"
- tell theDoc to set output option left footer size to 12
- tell theDoc to set output option left footer style to plain -- this is needed to override preferences file
- tell theDoc to set output option left footer style to italic
- tell theDoc to set output option left footer justification to left
- tell theDoc to set output option left footer color to green
- tell theDoc to set output option left footer text to "This is a Helvetica 12, italicized, left justified, green left footer"
-
- -- assign the right footer preferences
-
- tell theDoc to set output option right footer with include
- tell theDoc to set output option right footer font to "Monaco"
- tell theDoc to set output option right footer size to 12
- tell theDoc to set output option right footer style to plain -- this is needed to override preferences file
- tell theDoc to set output option right footer style to outline
- tell theDoc to set output option right footer justification to full
- tell theDoc to set output option right footer color to cyan
- tell theDoc to set output option right footer text to "This is a Monaco 12, outlined, full justified, cyan right footer"
-
- -- produce an output file called "SumOfTheParts.rtf" asking to the RTF translator to build the file
-
- tell theDoc to produce the file ":Examples:SumOfTheParts.rtf" using translator "RTF" with format "TEXT"
-
- -- save the DocAssembler document under the name "BuiltFromScript"
-
- save theDoc in file ":Examples:SumOfTheParts"
- quit
- end tell
- on error errText number errNum
- beep
- display dialog "An error occurred! " & errText & " Error code: " & errNum buttons {"Alas"} default button "Alas" with icon 0
- tell application "DocBreaker 1.0" to quit
- tell application "DocAssembler 1.0" to close theDoc saving no
- tell application "DocAssembler 1.0" to quit
- end try
- end timeout